home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
LIBRARY
/
DSOLVE.LI
< prev
next >
Wrap
Text File
|
1993-11-15
|
632b
|
16 lines
# differential eq solver
# the ordinary differential equation lib
# e.g. dsolve( y'(x) = x*y(x), y(x),x)
dsolve(f_,y_,x_) := subs(dsolver(subs(right(f), y=yy), yy,x), yy=y)
dsolver(f1_,y_,x_) := if(isfree(f1,y), y=inte(f1,x)+constant)
dsolver(f2_,y_,x_) := if(isfree(f2,x), inte(1/f2, y)=x+constant)
dsolver(f3_,y_,x_) := if(f3-coef(f3,y)*y==0,
y=constant*e^inte(coef(f3,y),x) )
dsolver(f4_,y_,x_) := if(f4-coef(f4,x)*x==0,
inte(1/coef(f4,x),y)=constant+x^2/2 )
dsolver(f5_,y_,x_) := if(isfree(f5-coef(f5,y)*y, y),
block(dsolve:=inte(coef(f5,y),x),
y=e^dsolve*(inte((f5-coef(f5,y)*y)*e^-dsolve,x)+constant)))